public class 求阶乘和 {
    public static void main(String[] args)
    {
        int n = 10;
        int ans = 0;
        int result = 1;
        for (int i = 1; i <= n; i++) {
            result = result * i;
            ans += result;
            System.out.println(result);
        }
        System.out.println("最终结果：" + ans);
    }
}
